package com.ebelter.myehc.ui.fragments;

import com.ebelter.btcomlib.bases.fragment.BaseFragment;
import com.ebelter.btcomlib.views.LevelColorView;
import android.os.Bundle;
import android.widget.TextView;
import com.ebelter.btcomlib.models.bluetooth.products.ear_temperature.EarTemperatureManager;
import com.ebelter.btcomlib.models.bluetooth.products.ear_temperature.bean.EarTemMesureResult;
import com.ebelter.btcomlib.utils.NumUtils;
import com.ebelter.btcomlib.utils.ViewUtils;
import com.ebelter.myehc.R;
import com.ebelter.myehc.ui.view.CombinView5;
import com.ebelter.myehc.utils.ViewUtilsEHC;


/**
 * 耳温枪
 */

public class ET_Fragment extends BaseFragment {

    public static final String TAG = "ET_Fragment";
    LevelColorView et_lcv;
    CombinView5 cb5_et;
    @Override
    protected int setLayoutResouceId() {
        return R.layout.fragment_et;
    }

    @Override
    protected void initView() {
        super.initView();
        FV();
    }
    private TextView activityTopTittleTv;

    public void setActivityTopTittleTv(TextView activityTopTittleTv) {
        this.activityTopTittleTv = activityTopTittleTv;
    }

    private void FV() {
        et_lcv = mRootView.findViewById(R.id.et_lcv);
        cb5_et = mRootView.findViewById(R.id.cb5_et);
    }

    @Override
    protected void initData(Bundle arguments) {
        super.initData(arguments);
        ViewUtilsEHC.setCb5Title2(cb5_et,N3);
    }

    public void setEarTemMesureResult(EarTemMesureResult result) {
        if (cb5_et!=null)cb5_et.setTitle2(result.temperature + "");
        ViewUtils.displayView(et_lcv);
        if (et_lcv!=null) et_lcv.setLevel(EarTemperatureManager.getResultLevel(result.temperature));
       // ToastUtil.show(EarTemperatureManager.getResultDesc(NumUtils.numBaoLiuWei1(result.temperature)));

        ViewUtils.setTextViewStr(activityTopTittleTv,EarTemperatureManager.getResultDesc(NumUtils.numBaoLiuWei1(result.temperature)));
    }
}
